package top.appx.util;

import java.sql.Timestamp;
import java.text.SimpleDateFormat;

/**
 * Created by zwy on 2015-5-29.
 */
public class DateTimeUtil {
    public static Timestamp now(){
        return new Timestamp(System.currentTimeMillis());
    }

    public static String juli(Timestamp time){
        if(time==null){
            return "";
        }
        long ju = (now().getTime()-time.getTime())/1000;
        if(ju<60){
            return ju+"秒前";
        }else if(ju<60*60){
            int minu = (int)ju/60;
            return minu+"分钟前";
        }else if(ju<60*60*24){
            int hour = (int)ju/60/60;
            return hour+"小时前";
        }else{
            int day = (int)ju/60/60/24;
            return day+"天前";
        }
    }



}
